package com.keti.controller;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.keti.Dao.ApplyPurchaseDao;
import com.keti.Dao.stuffDao;
import com.keti.DaoImpl.ApplyPurchaseDaoImpl;
import com.keti.DaoImpl.suffDaoImpl;
import com.keti.pojo.ApplyPurchase;
import com.keti.pojo.ApplyReceive;
import com.keti.pojo.stuff;

/**
 * Servlet implementation class CheckPurchaseServlet
 */
@WebServlet("/CheckPurchaseServlet")
public class CheckPurchaseServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		int id = Integer.parseInt(request.getParameter("id"));
		System.out.println(id);
		ApplyPurchaseDao apd = new ApplyPurchaseDaoImpl();
		ApplyPurchase ap = new ApplyPurchase();
		ap = apd.queryOne(id);
		System.out.println(ap.getSname());
		ap.setStatus("审核通过");
		apd.updata(ap);
		response.sendRedirect("ShowApplyPurchaseServlet");
		
		
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
